package com.andeveloper.springdemo.common;

import java.io.IOException;
import java.net.InetSocketAddress;

import net.spy.memcached.MemcachedClient;
import net.spy.memcached.internal.OperationFuture;

public class MemcacheClientUtil {
	
	private static MemcachedClient memCachedClient;
	
	public static void initMmCachedClient() throws IOException {
		InetSocketAddress inetSocketAddress = new InetSocketAddress("127.0.0.1", 11211);
		memCachedClient = new MemcachedClient(inetSocketAddress);  
	}
	
	public static Object get(String key) {
		return memCachedClient.get(key);
	}
	
	public static OperationFuture<Boolean> set(String key, Object value) {
		return memCachedClient.set(key, 0, value);
	}
}
